﻿using System.Collections.Generic;
using System.Windows;
using Caliburn.Micro;

namespace JY.Wpf.Core.Models
{
    /// <summary>
    /// 系统菜单
    /// </summary>
    public class SystemMenu: PropertyChangedBase
    {
        private int _msgCount;
        /// <summary>
        /// 构造器
        /// </summary>
        /// <param name="number">菜单编号</param>
        /// <param name="name">菜单名称</param>
        /// <param name="url">连接地址</param>
        /// <param name="icon">图标</param>
        /// <param name="sort">菜单排序</param>
        public SystemMenu(string number, string name, string url, string icon,int sort)
        {
            this.Number = number;
            this.Name = name;
            this.Url = url;
            this.Icon = icon;
            this.Sort = sort;
            this.SubMenus = new List<SystemMenu>();
        }
        /// <summary>
        /// 构造器
        /// </summary>
        /// <param name="name">菜单名称</param>
        public SystemMenu(string name)
        {
            this.Name = name;
            this.SubMenus = new List<SystemMenu>();
        }
        /// <summary>
        /// 构造器
        /// </summary>
        /// <param name="name">菜单名称</param>
        /// <param name="url">连接地址</param>
        /// <param name="icon">图标</param>
        public SystemMenu(string name, string url, string icon)
        {
            this.Name = name;
            this.Url = url;
            this.Icon = icon;
            this.SubMenus = new List<SystemMenu>();
        }

        /// <summary>
        /// 消息数量
        /// </summary>
        public int MsgCount
        {
            get { return this._msgCount; }
            set { this._msgCount = value; base.NotifyOfPropertyChange(); base.NotifyOfPropertyChange(() => this.MsgCountVisibility); }
        }

        /// <summary>
        /// 消息数量显示
        /// </summary>
        public Visibility MsgCountVisibility
        {
            get { return this.MsgCount > 0 ? Visibility.Visible : Visibility.Collapsed; }
        }
        /// <summary>
        /// 菜单编号
        /// </summary>
        public string Number { get; set; }
        /// <summary>
        /// 菜单名称
        /// </summary>
        public string Name { get; set; }
        /// <summary>
        /// 页面地址
        /// </summary>
        public string Url { get; set; }
        /// <summary>
        /// 页面地址
        /// </summary>
        public string Icon { get; set; }
        /// <summary>
        /// 颜色
        /// </summary>
        public string ColorBrushStr { get; set; }
        /// <summary>
        /// 子菜单集合
        /// </summary>
        public List<SystemMenu> SubMenus { get; set; }
        /// <summary>
        /// 菜单排序
        /// </summary>
        public int Sort { get; set; }

    }
}
